package com.becca.cake.service.voucher;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.dao.DataAccessException;
import org.springframework.web.multipart.MultipartFile;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.system.AdminDO;
import com.becca.cake.model.voucher.VoucherAdvertModel;
import com.becca.cake.model.voucher.VoucherModel;
import com.becca.cake.model.voucher.VoucherOrderDetailsModel;
import com.becca.cake.model.voucher.VoucherOrderExcelModel;
import com.becca.cake.model.voucher.VoucherOrderModel;
import com.becca.cake.model.voucher.VoucherUserPaymentsModel;

/**
 * 抵用券管理service接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author mouwanming
 * @date 2016年9月6日 下午4:05:52
 */
public interface IVoucherService {
	
	/**
     * 抵用券广告查询
     * @param map
     * @return
     * @throws Exception
     */
    List<VoucherAdvertModel> selectVoucherAdverts(Map<String, Object> map) throws Exception;
    
    /**
     * 获取抵用券广告总条数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectVoucherAdvertsCount(Map<String, Object> map) throws Exception;
    
    /**
     * 添加或修改抵用券广告信息
     * @param advertModel
     * @throws Exception
     */
    void insertOrUpdateVoucherAdvert(VoucherAdvertModel voucherAdvertModel,MultipartFile files, String fileTempPath,
                              AdminDO adminDo) throws Exception;
    
    /**
     * 添加确认发货图片
     * @param advertModel
     * @throws Exception
     */
    void insertVoucherOrderPicture(VoucherOrderModel voucherOrderModel,MultipartFile files, String fileTempPath,
                              AdminDO adminDo) throws Exception;
    /**
     * 根据id查询抵用券广告对象
     * @param advertId
     * @return
     */
    VoucherAdvertModel selectVoucherAdvertById(Integer voucherAdvertId);
    
    /**
     * 修改抵用券广告状态
     * @param map
     * @throws Exception
     */
    void updateAdvStatusById(Map<String, Object> map)throws Exception;
    
    /**
     * 批量修改排序
     * @param map
     * @throws Exception
     */
    void updateVoucherOrders(String jsonList)throws Exception;
    
    /**
     * 抵用券支付流水表查询
     * @param map
     * @return
     * @throws Exception
     */
    List<VoucherUserPaymentsModel> selectVoucherPayments(Map<String, Object> map) throws Exception;

    /**
     * 获取抵用券支付流水列表总条数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectVoucherPaymentsCount(Map<String, Object> map) throws Exception;
    
    /**
     * 查询所有抵用券
     * @param map
     * @return
     * @throws Exception
     */
    List<VoucherModel> selectVoucher(Map<String, Object> map) throws Exception;

    /**
     * 
     * 获取抵用券数据总条数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectVoucherCount(Map<String, Object> map) throws Exception;

    /**
     * 添加或修改抵用券信息
     * @param voucherModel
     * @throws Exception
     */
    void insertOrUpdateVoucher(VoucherModel voucherModel, AdminDO adminDo)
                                                                                            throws Exception;

    /**
     * 下架抵用券
     * @param id
     * @throws Exception
     */
    void updVoucherStatusById(Integer voucherId, Integer voucherStatus, String trueName)
                                                                                  throws ServiceException;

    /**
     * 根据抵用券ID查找抵用券
     * @param voucherId
     * @return
     * @throws ServiceException
     */
    VoucherModel selectVoucherById(Integer voucherId) throws Exception;

    /**
     * 批量修改商品排序
     * @param jsonList
     * @throws ServiceException
     */
    void updateVoucherOrder(String jsonList, String userName) throws ServiceException;

    /**
     * 查询抵用券订单数据
     * @param map
     * @return
     * @throws Exception
     */
    List<VoucherOrderModel> selectVoucherOrders(Map<String, Object> map) throws ServiceException;
    
    /**
     * 查询抵用券订单总记录数
     * @param map
     * @return
     * @throws Exception
     */
    Long selectVoucherOrdersCount(Map<String, Object> map) throws ServiceException;
    
    /**
     * 修改订单信息
     * @param voucherOrderModel
     * @throws ServiceException
     */
    void updateVoucherOrder(VoucherOrderModel voucherOrderModel) throws ServiceException;
    
    /**
     * 根据orderId查询订单对象，返回VoucherOrderModel
     * @param orderId
     * @return
     * @throws Exception
     */
     VoucherOrderModel findVoucherOrderById(Integer orderId) throws Exception;

    /**
     * 根据订单号查询订单详情
     * @param orderId
     * @return
     * @throws Exception
     */
    List<VoucherOrderDetailsModel> selectVoucherDetailsByOrderId(Integer orderId) throws Exception;
    
    /**
     * 修改订单状态
     * @param paramMap
     */
    void updateVoucherOrderStatus(Map<String, Object> paramMap) throws ServiceException;

    /**
     * 热敏订单生成静态页面
     * @param map
     * @throws ServiceException
     */
    List<String> printThermalOrder(String htmlFilePath, Map<String, Object> map) throws Exception;
    
    /**
     * 交接单打印：查询交接订单列表
     * @param orderIds
     * @return
     * @throws ServiceException
     */
    List<VoucherOrderModel> selectHandOverVoucherOrders(String orderIds) throws ServiceException;
    
    /**
     * 交接单打印：查询交接详情列表
     * @return
     * @throws ServiceException
     */
    List<VoucherOrderDetailsModel> selectHandOverVoucherOrderDetails(Integer orderId) throws ServiceException;

    
    /**
     * 批量导出
     * @param list
     * @throws ServiceException
     */
    void exportOrdersToExcel(HttpServletRequest request, HttpServletResponse response,
                             List<VoucherOrderDetailsModel> list) throws ServiceException;
    
    
    /**
     * 订单详情 ：导出excel
     * 
     * @param orderId
     * @return
     * @throws DataAccessException
     */
    List<VoucherOrderExcelModel> selectOrderExcelModel(String orderIds) throws ServiceException;
    
    /**
     * 修改物流信息
     * @param map
     * @throws ServiceException
     */
    void updateOrderLogisticsMessage(Map<String, Object> map) throws ServiceException;
    
    /**
     * 拒收订单
     * @param map
     * @throws ServiceException
     */
    void updRefuseReceiveOrder(Map<String, Object> map) throws ServiceException;
    
    /**
     * 每天的订单明细
     * @param preDayTime
     * @param nowDayTime
     * @return
     * @throws ServiceException
     */
    Map<String, Object> selectDayOrders() throws Exception;

    /**
     * 每天报表统计
     * @return
     * @throws Exception
     */
    Map<String, Object> statisticsOrderReport() throws Exception;

}
